package org.dandsoft.blackbox.mapreduce.client.operation;

import java.util.Map;

/**
 * @author Vilyuzhanin Denis (Fin)
 */
public class OperationFactory {

    public static Operation createOperation(Class<? extends Operation> operationClass, Map<String, String> properties) throws OperationException {
        try {
            Operation operation = operationClass.newInstance();
            operation.setProperties(properties);
            return operation;
        } catch (InstantiationException e) {
            throw new OperationException(e);
        } catch (IllegalAccessException e) {
            throw new OperationException(e);
        }
    }
}
